package com.hancher.gamelife2.home;


import android.view.LayoutInflater;
import android.view.ViewGroup;

import com.bumptech.glide.Glide;
import com.hancher.common.rv.BaseVBAdapter;
import com.hancher.gamelife2.databinding.ItemHomeStatisticBinding;

import lombok.Builder;
import lombok.Data;

public class HomeAdapter extends BaseVBAdapter<ItemHomeStatisticBinding, HomeAdapter.HomeItem> {

    @Override
    protected ItemHomeStatisticBinding createViewBinding(LayoutInflater from, ViewGroup viewGroup) {
        return ItemHomeStatisticBinding.inflate(from, viewGroup, false);
    }

    @Override
    protected void convertItem(ItemHomeStatisticBinding binding, int position, HomeItem item) {
        binding.tvTitle.setText(item.getTitle());
        binding.tvMsg.setText(item.getMsg());
        Glide.with(binding.imgIcon).load(item.getImg()).into(binding.imgIcon);
    }

    @Data
    @Builder
    public static class HomeItem {
        private String title;
        private String msg;
        private int action;
        private int img;
    }
}
